#ifndef Q4_HPP

#define Q4_HPP
#include <iostream>
#include <stack>
#include <queue>
using namespace std;
template <class T>
class myQueue
{
private:
    stack<T> front;
    stack<T> end;

public:

    void push(T ipt);
    void pop();
};
template <class T>
void myQueue<T>::push(T ipt)
{
    end.push(ipt);
}
template <class T>
void myQueue<T>::pop()
{
    if(front.size()!=0)
    {
            cout <<"抛出"<<front.top()<<endl;
        front.pop();
    }
 else if(end.size()!=0)
    {
        while (end.size()!=1){
                front.push(end.top());
                end.pop();
        }
        cout <<"抛出"<<end.top()<<endl;
        end.pop();
    }
 else{
        cout << "超出范围"<<endl;
    }
    
}
void q4()
{
     myQueue<int> q;
    for (int i =0;i<10;++i)
    q.push(i);
    
    for (int i = 0; i < 22; i++)
    {
        q.pop();
    }
    cout<<"对比 queue"<<endl;
    queue<int> qc ;
     for (int i =0;i<10;++i)
        qc.push(i);
    for (int i = 0; i < 22; i++)
    {
        cout << qc.front()<<endl;
        qc.pop();
    }
}
#endif